<template>
  <div class="hello">
    <h1>组件的{{count }}</h1>
    <button @click='fn'>fn</button>
  </div>
</template>

<script>
import { mapState } from "../store/myvuex";
export default {
  name: "HelloWorld",
  created() {
    console.log(this.$route.query);
  },
  methods: {
    fn() {
      setTimeout(() => {
        // this.$router.push("/about/8888");
        this.$router.replace("/about/8888");
      }, 2000);
    },
  },
  computed: {
    // count() {
    //   return this.$store.state.count;
    // },
    ...mapState(["count"]),
    // ...mapState("A", ["name"]),
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
